<script>
	$(function() {
		
		$( "#accordion" ).accordion({
		});
		
});

	</script>

<div id="accordion" class="test_page_1">
<?php 
$i=1;
global $base_url;
  foreach ($terms as $term){
	  if($i=='1'){$cls = "class='expand'";}?>
	  	  <h3><a href="#" class="active"><?php echo $term->name;?></a></h3>
	  <div>
		<div class="sub-accordion">
	   <div class="left_area_image">
			<?php //print taxonomy_image_display($term->tid);?>
			<?php $var= taxonomy_image_get_object($term->tid);
	   $d= strpos($var->path,'.');
	   $e= substr($var->path,$d);
	   $f= substr($var->path,0,$d);
	   $src = $base_url.'/sites/default/files/category_pictures/'.$f.'_test.png';
	   if($var->path !=""){
        echo "<img src='".$src."'/>";
	   }
	   ?>
	   </div>
		<div class="right_area_content">
		   <?php 
      // print_r($nodes);
		$nodes_list = get_node_from_term_id($term->tid);
	  if(count($nodes_list) >0){
		  
      
	  for($i=0;$i<count($nodes_list['title']);$i++)
	  {
		 $product = node_load($nodes_list['product_id'][$i]);
		  ?>
          <div class="<?php if($i == count($nodes_list['title'])-1){echo "last_";}?>accordion_details"><h7><?php print $product->title;?></h7>
          <p><?php print $nodes_list['related_product'][$i];?></p>
          <p class="details"><span class="right"><?php print l('details','tests/lists/'.$term->tid.'/'.$nodes_list['product_id'][$i]);?></span></p> </div>
	      <?php 
		   
	  }
	 }?>        
                                    
                              </div> <div class="clear"></div> 
       </div>
      </div>
	  <?php $i++;}?>
	</div>